import React, { useState } from 'react'
import {
  Checkbox,
  Popover,
  InputNumber,
  Button,
  Space
} from 'antd';

import styles from '../index.module.less'

function InputNumberItem({
  medicineId,
  label,
  quantity = 10,
  data,
  index,
  onChange
}) {

  function onChangeNumber(value) {
    let newList = JSON.parse(JSON.stringify(data));
    newList[index].quantity = value;
    onChange && onChange(newList)
  }

  return (
    <InputNumber
      addonBefore={label}
      step={1}
      precision={1}
      min={0.1}
      addonAfter="g"
      value={quantity}
      onChange={onChangeNumber}
    />
  )
}

export default InputNumberItem;